<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <link type="text/css" rel="stylesheet" href="main.css">
    <!--jquery -->
    <script type="text/javascript" src="../js/jquery/jquery-2.0.3.min.js"></script>

    <script type="text/javascript" src="../js/share.js"></script>

    <script type="text/javascript">
        var itemno = "";
        var applyid = "";
        var nodeno = "";
        var orgcode = "";
        var nextnodecode1 = "";
        var selectID = "userlist";
        var applyno = "";

        $(function () {
        	var d = new Date();
//         	$('[name="today"]').html(d.format('yyyy-MM-dd'));
        	
            applyno = getUrlParam("applyno");
            bindApply(applyno);
        });


        function bindApply(applyno) {
            $.ajax({
                url: basePath() + 'business/getapplyinfo.do',
                data: {
                    "applyno": applyno
                },
                dataType: "json",
                contentType: "application/json",
                success: function (data) {
                    if (data.result == 1) {
                        var jsonApply = data.datas;

                        bindApplyForm(jsonApply);

                        //绑定业务资料
                        bindBusinessForm(jsonApply['applyid'], jsonApply['itemno']);

//                         //绑定附件材料
//                         bindMaterialListForm(jsonApply['applyid']);
                        
//                         //绑定初审意见
//                         bindFirstTrialOpinion(jsonApply['applyid']);
                        
                    }
                }
            });
        }

        function bindApplyForm(jsonApply) {
            for (var d in jsonApply) { //遍历json对象的每个key/value对,p为key
                if (d == 'applytime' || d == 'syscreated') {
                    $('#' + d).html(formatDate(jsonApply[d], 'yyyy年mm月dd日'));
                } else {
                    $('#' + d).html(jsonApply[d] == '' ? '/' : jsonApply[d]);
                }
            }
        }

        function bindBusinessForm(applyid, itemno) {

            $.ajax({
                url: basePath() + 'business/getwatersworkcerinfo.do',
                data: { "applyid": applyid },
                dataType: "json",
                contentType: "application/json",
                success: function (data) {
                    if (data.result == 1) {
                        var jsonBusiness = data.datas;
                        for (var d in jsonBusiness) { //遍历json对象的每个key/value对,d为key
//                             if (d == 'workbegintime') {
//                                 $('#beginTimeYear').html(jsonBusiness[d]['year'] + 1900);
//                                 $('#beginTimeMonth').html(jsonBusiness[d]['month'] + 1);
//                                 $('#beginTimeDay').html(jsonBusiness[d]['date']);
//                             } else if (d == 'workendtime') {
//                                 $('#endTimeYear').html(jsonBusiness[d]['year'] + 1900);
//                                 $('#endTimeMonth').html(jsonBusiness[d]['month'] + 1);
//                                 $('#endTimeDay').html(jsonBusiness[d]['date']);
//                             } else if (d == 'syscreated') {
//                                 $('#' + d).html(formatDate(jsonBusiness[d], 'yyyy年mm月dd日'));
//                             } else if (d == 'workarea') {
// 								var s = '';
// 								if('' != jsonBusiness['waterwayname'])
// 									s += jsonBusiness['waterwayname'] + '，';
// 								if('' != jsonBusiness['navigationmarkname'])
// 									s += jsonBusiness['navigationmarkname'] + '，';
								
// 								s += jsonBusiness['workposition'] + '，' + jsonBusiness['workarea'];
// 								$('#' + d).html(s);
// 							}
//                             else if (d == 'workname') {
//                                 $('#' + d).html(jsonBusiness[d]);
//                                 $('#workname1').html(jsonBusiness[d]);
//                             }

                        	if (d == 'workbegintime' || d == 'workendtime' || d == 'certificatedate') {
                            	$('#' + d).html(formatDate(jsonBusiness[d], 'yyyy年mm月dd日'));
                        	}
	                        else if (d == 'workname') {
		                        $('#' + d).html(jsonBusiness[d]);
		                        $('#workname1').html(jsonBusiness[d]);
	                     	}
                            else {
                                $('#' + d).html(jsonBusiness[d] == '' ? '/' : jsonBusiness[d]);
                            }

                        }
                    }
                }
            });
//             $.ajax({
//                 url: basePath() + 'business/getshipinfo.do?applyid=' + applyid,
//                 dataType: "json",
//                 success: function (data) {
//                     if (data.result == 1) {
//                         var jsonDevice = data.datas;
//                         var shipname = '';
//                         for (var i = 0; i < jsonDevice.length; i++) {
// //                             $("#shipname").html(jsonDevice[i]['shipname']);
//                         	shipname += jsonDevice[i]['shipname'] + '、';
//                         }
//                         if(shipname.length > 0){
//                         	shipname = shipname.substring(0, shipname.length - 1);
//                         }
//                         $("#shipname").html(shipname);
//                     }
//                 }
//             });
        }

        function bindMaterialListForm(applyid) {

            $.ajax({
                url: basePath() + 'business/getmaterialinfo.do',
                data: {
                    "applyid": applyid
                },
                dataType: "json",
                contentType: "application/json",
                success: function (data) {
                    if (data.result == 1) {
                        var jsonMaterial = data.datas;

                        var k = 1;
                        for (var i = 0; i < jsonMaterial.length; i++) {
                            var materialname = jsonMaterial[i]['materialname'];

                            var fileid = jsonMaterial[i]['fileid']
                            if ('' != fileid) {
                                var materialnameHmtl = k + '、' + materialname + '<br />';
                                $('#material').append(materialnameHmtl);
                                k++;
                            }
                        }
                    }
                }
            });
        }
        
        function bindFirstTrialOpinion(applyid){

            $.ajax({
                url: basePath() + 'business/getfirsttrialOpinion.do',
                data: {
                    "applyid": applyid
                },
                dataType: "json",
                contentType: "application/json",
                success: function (data) {
                    if (data.result == 1) {
						var opinion = data.datas.opinion;
						$('#opinion').html(opinion);
                    }
                }
            });
        }
    </script>
    <style>
        table {
            border-color: black;
            border-collapse: collapse;
            width: 760px;
        }
    </style>
    <title>水上水下活动许可证</title>
</head>

<body>
    <table align="center" cellspacing="0" cellpadding="0" style="font-size: 18px;">
    	<tr>
			<td colspan="3" style="height: 80px;">
			</td>    		
    	</tr>
        <tr>
        	<td style="width:20%; height: 100px; text-align: right;">
        		<img alt="" src="image/msa.gif">
        	</td>
        	<td style="text-align: center; font-weight: bold; font-size: 26px;">
	        		中华人民共和国<br /><br />
	        		水上水下活动许可证
        		
        	</td>
        	<td style="width:20%;">
        	</td>
       	</tr>
       	<tr>
       		<td colspan="3" style="text-align: right; height: 150px;">
       			<span id="orgname"></span>&nbsp;<span>准字（<span id="certificateyear"></span>&nbsp;<span>）第<span id="certificatenumber"></span>&nbsp;<span>号</span>
       		<td>
   		</tr>
   		<tr>
   			<td colspan="3" style="text-indent:2em;">
   				<div style=" min-height: 750px;">
	   				<div style="line-height:200%; ">
	   				经审核，准许
	   				<ins style="font-weight: lighter ;">&nbsp;&nbsp;&nbsp;&nbsp;<span id="workunitname"></span>&nbsp;&nbsp;&nbsp;&nbsp;</ins>
	   				自
	   				<ins style="font-weight: lighter;">&nbsp;&nbsp;&nbsp;&nbsp;
	   						<span id="workbegintime"></span>&nbsp;&nbsp;&nbsp;&nbsp;
                    </ins>
	   				至
	   				<ins style="font-weight: lighter;">&nbsp;&nbsp;&nbsp;&nbsp;
	   						<span id="workendtime"></span>&nbsp;&nbsp;&nbsp;&nbsp;
                    </ins>，
	   				由
	   				<ins style="font-weight: lighter;">&nbsp;&nbsp;&nbsp;&nbsp;<span id="workship" ></span>&nbsp;&nbsp;&nbsp;&nbsp;</ins>
	   				在
	   				<ins style="font-weight: lighter;">&nbsp;&nbsp;&nbsp;&nbsp;<span id="workarea" ></span>&nbsp;&nbsp;&nbsp;&nbsp;</ins>
	   				范围内进行
	   				<ins style="font-weight: lighter;">&nbsp;&nbsp;&nbsp;&nbsp;<span id="workname" ></span>&nbsp;&nbsp;&nbsp;&nbsp;</ins>
	   				作业。
	   				</div>
	   				<div style="line-height:200%">
	   					<ins style="width: 500px;">鉴管要求（附后）</ins>。
	   				</div>
	   				<div style="line-height:200%; width: 500px;">
	   					特发此证。
	   				</div>
   				</div>
   			</td>
   		</tr>
   		<tr>   			
   			<td colspan="3" style="text-indent:2em;">
   			</td>
   		</tr>
   		<tr>   			
   			<td colspan="3" style="text-align: right;">
   				<div style="margin-right: 50px;">
   				<p>(通航安全管理专用印章)</p>
                <p name="certificatedate" id="certificatedate"></p>
   				</div>
   			</td>
        </tr>
    </table>
</body>

</html>
